package huawei;

class ShuiFlower {
    public static void main(String args[]) {
        int[] arr=new int[10];
        int j=1;
        int sum=0;
       for (int i=100; i<1000; i++) {
          int g=i%10;
          int t=(i/10)%10;
          int h=i/100;
          if (g*g*g+t*t*t+h*h*h==i) {
              arr[j]=i;
              j++;
              sum+=i;
          }
       } 
       for (int i=1; i<j; i++) {
           System.out.println("第"+i+"水仙花数:"+arr[i]);
       }
       System.out.println("水仙花数总和为:"+sum);
    }
}
